NES Big Nametable Editor
Author: Taylor Plewe
Email me at tplewe@outlook.com

Date of writing: February 16, 2021

I created this program because I couldn't find one anywhere on the internet that allowed the user to create a nametable/map for use in an NES game that was larger than the size of 1 NES screen; i.e. a sort of overworld map used for scrolling.  I created this one in C#, Visual Studio 2012.
- I use the term "nametable" and "map" interchangeably.  It refers to the panel on the right, the end result of the program, what will be loaded into the PPU and used as the background for an NES game.
- I pulled the "Color picker" image straight from Wikipedia.

NOTE: Sorry about that warning that comes up when you run the program, telling you the program is from an unkown publisher or whatever.  I don't know much about signing an EXE or stuff like that, or verifying myself as a publisher or whatever, so if any of you would like to let me know how I can make that warning not be there in the future, please do!

	******

Contents
1. Key shortcuts
2. CHR files
3. Editor modes
4. Features to come
5. File syntax notes
6. File format examples
7. Update logs

	******

1. KEY SHORTCUTS
W, A, S, D	Move tile/metatile select cursor U, L, D, R
1, 2, 3, 4	Select palettes 1, 2, 3, or 4
Ctrl + T	Fill map/metatile grid with selected tile/metatile
Ctrl + P	Fill map/metatile grid with selected palette (NOTE: not in Metatile/Map mode)
Ctrl + N	Edit size of map, in 8x8 tiles
Ctrl + M	Edit size of metatile grid, in 16x16 tiles (up to 16 by 16)
Ctrl + L	Bring up layout select dropdown
Ctrl + G	Toggle metatile 16x16 grid
ESC		Cancel palette editing mode

2. CHR FILES

I didn't bother implementing a way to create and edit a CHR file.  It is assumed that a complete CHR file is ready to go when you open up the program.  This is because there already are plenty of programs that do this.  The one I have and use, and that I recommend, is "yy-chr".

3. EDITOR MODES

There two ways to create and edit a nametable/map.
	The first way, and the mode that the program opens with, is drawing individual 8x8 tiles from the CHR file (the same data found in the CHR ROM in a game) to the nametable.
	The second is by creating 16x16 "metatiles" and drawing those onto the map.  You first draw (or import) the metatiles in the Tiles/Metatiles mode, and then switch to Metatiles/Map mode and draw the metatiles onto the map.  Metatiles are/were very commonly used in larger maps for NES games because, although you need some memory to store the little grid of metatiles, it will save a ton of space in the long run because the actual map data will take up 1/4 as much space.  And when dealing with NES game development, space in memory is precious.

4. FEATURES TO COME

There's a few things that I didn't get around to implementing just yet but I plan on doing.
- Undo/redo (Ctrl + Z)
- Another editor mode where you can draw an invisible grid of 'walls' to use in a game, and just exports a grid of 1s and 0s where there is or isn't walls (this could obviously be used for a lot more than just walls, i.e. other objects)
- The ability to paint palettes onto the map while in Metatile/Map mode (it's kinda messy under the hood and that's why I didn't bother)
- A better/cleaner way for importing/exporting, since there's so many little files the program deals with.  Think like a seperate form that pops up where you just load in all the different files into the one form and it keeps track of them all and displays their paths or whatever.

5. FILE SYNTAX NOTES

- All assembly (ASM) files to be imported must begin every row of data with ".db".
- All assembly files must end each byte, except for the last one in each row, with a comma (,).
- Palette tile ASM files must begin each byte with % and be in binary.
- All other ASM files must begin each byte with $ and be in hex.
- Palette ASM can be more than one line (for instance, the first line for the nametable palettes and the second for the sprite palettes in an NES game); only the first line will be read.
- Metatile palette files are in CSV because it's easier to work with and these aren't getting put anywhere in the game, they're only used to color the metatiles in this program.  Palettes for a map with metatiles drawn on it are derived from the metatiles' palettes, but then inserted into the map's own palette grid behind the scenes.  Thus, palettes are exported the same way whether you're drawing 8x8 tiles or 16x16 metatiles.  (File > "Export Map palette tiles ASM")
- Metatile assembly files are such that each group of four bytes refers to one metatile; going from top left of the metatile grid and reading like a book.

6. FILE FORMAT EXAMPLES

- Palettes ASM
	.db $0f,$12,$22,$20, $0f,$16,$26,$20, $0f,$19,$29,$20, $0f,$1c,$2c,$20
- Map tiles ASM (must actually be larger than this)
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
- Map palette tiles ASM (must actually be larger than this)
	.db %01010101, %01010101, %01010101, %01010101
	.db %01010101, %01111111, %01010101, %01010101
	.db %01010101, %01010101, %00000000, %01010101
	.db %01010101, %01010101, %01010101, %01010101
- Metatiles tiles ASM
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
	.db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
- Metatiles palette tiles CSV
	0,0,0,0,0,0,0,0
	0,0,2,0,0,3,0,0
	0,0,0,0,0,0,0,0
	0,1,0,0,0,0,1,0
	0,1,0,0,0,0,1,0
	0,0,1,0,0,1,0,0
	0,0,0,1,1,0,0,0
	0,0,0,0,0,0,0,0

7. UPDATE LOGS

1.1 - February 21, 2021
Fixed issue where importing and exporting the attribute/palette map would reverse each byte.  I was thinking the least significant byte was on the left for some reason

1.0 - February 16, 2021
Initial release












